import cookie from 'cookie_js'

const token_key = 'token'
const UserName = "username"
const UserId = "user_id"

// expires: 过期时间单位:天
export function getToken(){
  return cookie.get(token_key)
}

export function setToken(token){
  return cookie.set(token_key,token)
}

export function removeToken(){
  return cookie.remove(token_key)
}

export function getUserName(){
  return cookie.get(UserName)
}

export function setUserName(username){
  return cookie.set(UserName,username)
}

export function removeUserName(){
  return cookie.remove(UserName)
}

export function getUserId(){
  return cookie.get(UserId)
}

export function setUserId(user_id){
  return cookie.set(UserId,user_id)
}

export function removeUserId(){
  return cookie.remove(UserId)
}

// export const getToken = () => {
//   const token = Cookies.get(TOKEN_KEY)
//   if (token) return token
//   else return false
// }